package ui;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;


import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.border.MatteBorder;

public class ItemList extends JPanel {
	
	
	private JPanel mainList;
	
	public ItemList(final String name,final int sizePctY) {
		setLayout(new BorderLayout());
		mainList = new JPanel(new GridBagLayout());

		GridBagConstraints gbc = new GridBagConstraints();
		
		//GBC for resizing
        gbc.gridwidth = GridBagConstraints.REMAINDER;
        gbc.weightx = 1;
        gbc.weighty = 1;
        mainList.add(new JPanel(), gbc);
        add(new JScrollPane(mainList));

	}
	protected void setPanels(JPanel panel, String item1,String item2, String item3, String item4){
		
	}
	
	protected void setPanels(JPanel p, Object o)
	{

	}
	public void newPanel(Object o)
    {
    	JPanel panel = new JPanel();
        panel.setLayout(new BorderLayout());
        //panel.setPreferredSize(new Dimension( 200 , 50 ));
        panel.setBorder(new MatteBorder(0, 0, 1, 0, Color.GRAY));
        setPanels(panel,o);
        
         GridBagConstraints filler = new GridBagConstraints();
         filler.gridwidth = GridBagConstraints.REMAINDER;
         filler.weightx = 0;
        
         filler.fill = GridBagConstraints.HORIZONTAL;
         mainList.add(panel,filler,0);

         validate();
         repaint();
    }
	
	public void newPanel(String item1, String item2, String item3, String item4 )
    {
    	JPanel panel = new JPanel();
        
		
        panel.setLayout(new BorderLayout());
        panel.setPreferredSize(new Dimension( 500 , 70 ));
         panel.setBackground(Color.ORANGE);
         panel.setBorder(new MatteBorder(0, 0, 1, 0, Color.GRAY));
         setPanels(panel,item1,item2,item3,item4);
        
         
        
         GridBagConstraints filler = new GridBagConstraints();
         filler.gridwidth = GridBagConstraints.REMAINDER;
         filler.weightx = 1;
        
         filler.fill = GridBagConstraints.HORIZONTAL;
         mainList.add(panel, filler, 0);

         validate();
         repaint();
    }
}
